<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTokensTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tokens', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->index()->comment("邮箱或手机号码");
            $table->string('type',20)->default("email")->comment("类型,email,phone");
            $table->string('action',20)->default("register")->comment("token操作register,reset_password");
            $table->string('token')->comment("token");
            $table->string('table_name',20)->nullable()->comment("表名，空指users");
            $table->timestamp('expire_at')->comment("过期时间");
            $table->timestamp('created_at')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tokens');
    }
}
